Les fichiers Shapefile sont dans le dossier CartographieR/IGN_GEOFLA_2014.
CartographieR + IGN_GEOFLA_2014
|
+ RCarto + ALCA
+ Wickham
require("rgdal") # requires sp, will use proj.4 if installed
## Loading required package: rgdal
## Loading required package: sp
## rgdal: version: 0.9-2, (SVN revision 526)
## Geospatial Data Abstraction Library extensions to R successfully loaded
## Loaded GDAL runtime: GDAL 1.11.1, released 2014/09/24
## Path to GDAL shared files: /usr/share/gdal/1.11
## Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
## Path to PROJ.4 shared files: (autodetected)
require("maptools")
## Loading required package: maptools
## Checking rgeos availability: TRUE
path <- "../../IGN_GEOFLA_2014/GEOFLA_2-0_COMMUNE_SHP_LAMB93_FXX_2014-12-05/GEOFLA/1_DONNEES_LIVRAISON_2014-12-00066/GEOFLA_2-0_SHP_LAMB93_FR-ED141/COMMUNE"
file <-"COMMUNE"
france <- readOGR(dsn = path, layer = file)
## OGR data source with driver: ESRI Shapefile
## Source: "../../IGN_GEOFLA_2014/GEOFLA_2-0_COMMUNE_SHP_LAMB93_FXX_2014-12-05/GEOFLA/1_DONNEES_LIVRAISON_2014-12-00066/GEOFLA_2-0_SHP_LAMB93_FR-ED141/COMMUNE", layer: "COMMUNE"
## with 36595 features
## It has 18 fields
d.france <- france@data
par(mar = rep(0,4)) # on fait de la place
# extraction d'un départementst<-france[france$CODE_DEPT==67,]
br <- france[france$CODE_DEPT == 67,]
plot(br)
# extraction d'une région
lorraine <- france[france$NOM_REG == "LORRAINE",]
plot(lorraine)
alsace <- france[france$NOM_REG == "ALSACE",]
plot(alsace)
# extraction ALCA
alca <- france[france$NOM_REG %in% c("ALSACE","LORRAINE","CHAMPAGNE-ARDENNE"),]
plot(alca)
d.alca <- alca@data
# utilisation de unionSpatialPolygons pour les REGIONS
alca.region <- unionSpatialPolygons(alca, IDs = alca@data$CODE_REG)
plot(alca.region)
# carte des départements
alca.dept <- unionSpatialPolygons(alca, IDs = alca@data$CODE_DEPT)
plot(alca.dept, main = "Les 10 départements ALCA")
# régions et départements
plot(alca.dept, main = "Les 3 régions et 10 départements ALCA")
plot(alca.region, border = "blue", lwd = 2, add = TRUE)
# échelle
ech = 50000 # longueur de l'échelle en mètres
x = par()$usr[1]
y = par()$usr[3]
arrows(x + 1000, y + 1000, x + ech, y + 1000, lwd = 2, code = 3, angle = 90, length = 0.05)
text(x + 25500, y + 15000, "50 km", cex = 1)
# corection des caractères anormaux
d.alca$STATUT <- factor(gsub("\xe9", "é", d.alca$STATUT, fixed = FALSE))
# capitales régionales
x <- d.alca$X_CHF_LIEU[d.alca$STATUT == "Préfecture de région"]
y <- d.alca$Y_CHF_LIEU[d.alca$STATUT == "Préfecture de région"]
nom <- d.alca$NOM_COM[d.alca$STATUT == "Préfecture de région"]
points(x, y, col = "red", pch = 19, cex = 1.2)
text(x, y, labels = nom, cex = 0.8, pos = c(4,2,4))
# préfectures
# données régionales
d.alsace <- alsace@data
names(d.alsace)
## [1] "ID_GEOFLA" "CODE_COM" "INSEE_COM" "NOM_COM" "STATUT"
## [6] "X_CHF_LIEU" "Y_CHF_LIEU" "X_CENTROID" "Y_CENTROID" "Z_MOYEN"
## [11] "SUPERFICIE" "POPULATION" "CODE_CANT" "CODE_ARR" "CODE_DEPT"
## [16] "NOM_DEPT" "CODE_REG" "NOM_REG"
Les caractéristiques et la geomocalisation des hôpitaux alsaciens est dans __RPU_Doc/Carto/Hopitaux_Alsace.csv
file <- "RPU_Doc/Carto/Hopitaux_Alsace.csv"
path <- "../../../Resural/Stat Resural/"
hop67 <- read.csv(paste0(path, file))
names(hop67)
## [1] "HOPITAL" "LAT" "LONG" "LAMB93_X" "LAMB93_Y"
## [6] "RPU_NAME" "FINESSG" "FINESSJ" "GROUPE" "TERRITOIRE"
## [11] "ZONEP" "TYPE" "STATUT" "LITS_TOT" "LITS_MED"
## [16] "LITS_CHIR" "LITS_REA" "URG_JOUR" "COMPETENCE" "SOURCE"
# carte de l'Alsace
plot(alsace)
# implantation des hôpitaux
points(hop67$LAMB93_X, hop67$LAMB93_Y, col = "red", pch = 19)
# détail Strasbourg
str <- alsace[alsace$NOM_COM == "STRASBOURG",]
plot(str)
# Place les SU. Le point est prop au nombre de lits
points(hop67$LAMB93_X, hop67$LAMB93_Y, col = "red", pch = 19, cex = hop67$LITS_TOT / 250)
text(hop67$LAMB93_X, hop67$LAMB93_Y, hop67$HOPITAL, cex = 0.8, pos = 4)
# place des SU. le point est prop au nombre de passages moyen en 2013 (SAE)
par(mar = c(0,0,0,0))
plot(str)
points(hop67$LAMB93_X, hop67$LAMB93_Y, col = "green", pch = 19, cex = hop67$URG_JOUR/50)
text(hop67$LAMB93_X, hop67$LAMB93_Y, hop67$HOPITAL, cex = 0.8, pos = 4)
urg.moy.jour <- c(50, 100, 150, 200)
legend("topleft", legend = urg.moy.jour, pch = 19, col = "green", pt.cex = urg.moy.jour/50, bty = "n", title = "moyenne des passages\n par jour")
# échelle
ech = 5000 # longueur de l'échelle en mètres
x = par()$usr[1]
y = par()$usr[3]
arrows(x + 1000, y + 1000, x + ech, y + 1000, lwd = 2, code = 3, angle = 90, length = 0.05)
text(x + 2550, y + 1500, "5 km", cex = 1)
Commune de France la plus étendue à cause de sa fôret => densité corrigée = nb habitants / superficie - 13742 hectares (foret indivise de Haguenau)
La meilleure source est le répertoire scope.santé et notamment les fiches détaillées, accessibles à l’adresse http://www.scopesante.fr/fiches-detaillees/ + FINESS géographique. Exemple pour Haguenau: http://www.scopesante.fr/fiches-detaillees/670000157/. La rubrique ndicateurs volumétriques d’activité renseigne sur les lits
Enquete FEDORU sur les SU, SAMU, SMUR. Lefichier complété au 8/5/2015 est enregistré dans RPU_Doc/Cartographie.
source seminR pp 25-27
Système géographique de référence Avoir le bon CRS !
Accès aux données du fichier des codes de référence EPSG EPSG <-make_EPSG ()
Recherche du bon code, exemple pour les projections Lambert xx (EPSG_Lambert <- EPSG [grep(“Lambert”, EPSG$note), 1:2] )
Trois codes incontournables
row | code EPSG | note | argument
—–|————-|——–|———-
249 | 4326 | WGS 84 | +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
584 | 2154 | RGF93 / Lambert-93 | +proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0, 0,0,0,0,0,0 +units=m +no_defs
2985 | 27572 | NTF (Paris) / Lambert zone II | +proj=lcc +lat_1=46.8 +lat_0=46. 8 +lon_0=0 +k_0=0.99987742 +x_0=600000 +y_0=2200000 +a=6378249.2 +b=6356515 +towgs84=-168,-60,320,0,0,0,0 +pm=paris +units=m +no_defs
WGS 84 : système géodésique mondial (World Geodesic System 1984). Celui de Google Earth.
NTF : Nouvelle Triangulation pour la France (1873 - 1991).
RGF : Réseau Géodésique Français(à partir de 1990).
RGF93 :Réseau géodésique français légal pour la métropole depuis le décret du 26.12.2000
Lambert : système de projection utilisé pour la France (4 zones).
Lambert93 : projection associée au système géodésique RGF93 (compatible avec WGS84)
Changer de système de référence pour des objets de classe : Spatial… [ librairie sp ] library (rgdal) d78 <- readOGR (“Dept78.TAB”, layer=“Dept78”) proj4string (d78) # Affiche le système de référence (CRS) “+proj=lcc +lat_1=45.898918964419 +lat_2=47.696014502038 +lat_0=46.8 +lon_0=0 +x_0=600000 +y_0=2200000 +a=6378249.2 +b=6356515.000000472 +towgs84=-168,-60,320,-0,-0,-0,0+pm=2.337229166667 +units=m +no_defs”
plot (d78, axes = TRUE, las=2)
title (“epsg 27572 - NTF (Paris) / Lambert zone II”)
Reprojeter en RGF93, code EPSG : 2154
d78RGF93 <-spTransform(d78, CRS (“+init=epsg:2154”) ) proj4string (d78RGF93) “+init=epsg:2154 +proj=lcc +lat_1=49 +l at_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0, 0,0,0,0,0,0 +units=m +no_defs” plot (d78RGF93, axes = TRUE, las=2) title (“epsg 2154 # RGF93 / Lambert-93”)
Reprojeter en WGS 84 , code EPSG : 4326 d78WGS84 <- spTransform(d78, CRS (“+init=epsg:4326”) ) proj4string (d78WGS84) “+init=epsg:4326 +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0” plot (d78WGS84, axes = TRUE, las=2) title (“epsg 4326 # WGS 84”)
library("OpenStreetMap")
## Loading required package: rJava
## Loading required package: raster
Nantes <- c(47.227962,-1.558113)
map <- openmap(c(Nantes[1]+0.1,Nantes[2]-0.2), c(Nantes[1]-0.1,Nantes[2]+0.2),type='osm')
plot(map,raster=TRUE)
map <- openmap(c(Nantes[1]+0.2,Nantes[2]-0.3), c(Nantes[1]-0.1,Nantes[2]+0.2),type='osm')
plot(map,raster=TRUE)
map <- openmap(c(Nantes[1]+0.01,Nantes[2]-0.02), c(Nantes[1]-0.01,Nantes[2]+0.02),type='osm')
plot(map,raster=TRUE)